/**
 * @Date 2023-03-21 14:00:07
 * @Remark
 */

// lib
// config
// script & methods & public
import logUtils from "utils/logUtils";
// store
import { state } from "./state";
// service
import { getLogPageService } from "biz/Log/service";
import { ReqLogPage } from "biz/Log/api";
// interface
// 其它

export async function getLogPage() {
  const sp = state.getSearch();
  logUtils.info("搜索参数", sp);
  const params: ReqLogPage = {
    pageNum: state.page,
    pageSize: state.size,
    ...sp,
  };
  // 调用服务
  state.loading = true;
  const result = await getLogPageService(params);
  state.loading = false;
  // 成功
  if (result.payload) {
    state.total = result.payload.total;
    state.list = result.payload.list;
  }
}

export async function didMount() {
  getLogPage();
}
